<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../css/bdz.css">
    <title>界泾变电所</title>
</head>

<body>

    <div class="bdz-title">界泾隧道变电所监控系统</div>
    <div class="clock"></div>
    <!-- <div class="show-loadname-bt">负荷名称</div> -->
    <!-- <div class="link-to-chart">实时数据报表</div> -->
    <!-- <div class="back-to-xtt">×</div> -->
    <img class="bdz-svg" src="../img/bdz/jjbg.svg">
    <div id="bdz-container" class="bdz-panel"></div>
   

    <div id="transformer-container" class="transformer-panel"></div>
    <div id="rtrh-container-bdz" class="rtrh-container"></div>

    <div class="switch-panel-container"></div>

    <script src="../js/jquery-3.6.0.min.js"></script>
    <script src="../js/echarts.min.js"></script>
    <script src="../js/widget-circuit.js"></script>
    <script src="../js/scada.js"></script>
    <script src="../js/jjbdz-data.js"></script>

    <script>
        
        // 实时数据报表链接
        $('.link-to-chart').on('click', function () {
            window.open('qqbb-report.html')
        })
         
        // 返回主页
        $('.back-to-xtt').on('click', function () {
            // window.open('qqsd.html', '_self')
        })

        var components = {};
        var devices = [];
        //--------------开关第一排----------
        switchData1.forEach(item => {
            var option = $.extend({}, item);
            components[option.code] = $('#bdz-container').switch1(option);
            devices.push(option.code);
        });
       

        // ---------变压器----------
        transformerData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            components[option.code] = $('#transformer-container').transformer(option);
            devices.push(option.code);

        });

        // ---------温湿度----------
        thData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            components[option.code] = $('#rtrh-container-bdz').rtrh(option);
            devices.push(option.code);
        });

        refreshData();
        setInterval(refreshData, 2000);

        function refreshData() {
            findPropertiesByCodes(devices.toString(), function (result) {
                for (let p in result) {
                    var comp = components[p];
                    if (comp) {
                        comp.update(p, result[p]);
                    }
                }
            });
        }

    </script>

</body>

</html>